<script setup>
import { ref } from 'vue'
import { Search } from '@element-plus/icons-vue'

const drawer = ref(false)

// 搜索
const input3 = ref('')
const select = ref('')

// 表格数据
const tableData = [
  {
    date: '2025-05-03',
    name: '开发工程师',
    location: '沈阳',
    salary: '10K',
    company: '华为',
    satrTime: '2025-05-03',
    endTime: '2025-05-03',
    qualifications:'计算机相关专业，能接受弹性工作（出差跑外50%+坐班研发50%）热爱计算机，喜欢钻研技术，超强的自学能力，能迅速掌握新需求新功能。至少掌握一种主流数据库，两种或两种以上编程语言（Java，Py，C系）能兼顾前端后端开发，测试，实施，运维。性格开朗，内敛沉稳，不抗拒与陌生人打交道。有耐心为药房营业员提供技术制导。',
    job_responsibilities:'完善现有药房收银系统。为新客户部署公司系统。日常系统运维。外出处理老客户系统宕机，bug等。为客户提供系统教学指导。',
    family: [ 
      {
        name: '张三',
        state: '辽宁',
        city: '沈阳',
        address: '浑南区金科街',
        zip: '999',
      },
      {
        name: '张三',
        state: '辽宁',
        city: '沈阳',
        address: '浑南区金科街',
        zip: '999',
      },
    ],
  },
  {
    date: '2025-05-03',
    name: '开发工程师',
    location: '沈阳',
    salary: '10K',
    company: '华为',
    satrTime: '2025-05-03',
    endTime: '2025-05-03',
    qualifications:'计算机相关专业，能接受弹性工作（出差跑外50%+坐班研发50%）热爱计算机，喜欢钻研技术，超强的自学能力，能迅速掌握新需求新功能。至少掌握一种主流数据库，两种或两种以上编程语言（Java，Py，C系）能兼顾前端后端开发，测试，实施，运维。性格开朗，内敛沉稳，不抗拒与陌生人打交道。有耐心为药房营业员提供技术制导。',
    job_responsibilities:'完善现有药房收银系统。为新客户部署公司系统。日常系统运维。外出处理老客户系统宕机，bug等。为客户提供系统教学指导。',
    family: [ 
      {
        name: '张三',
        state: '辽宁',
        city: '沈阳',
        address: '浑南区金科街',
        zip: '999',
      },
      {
        name: '张三',
        state: '辽宁',
        city: '沈阳',
        address: '浑南区金科街',
        zip: '999',
      },
    ],
  },
]
// 地点搜索
const input_location = ref('')

//

// 文本域
const textarea = ref('')
const textarea1 = ref('')
// 数字输入框
const num = ref(1)
// 日期选择器
const datetime = ref('')
// 选择器
const options = [
  {
    value: 'Option1',
    label: 'Option1',
  },
  {
    value: 'Option2',
    label: 'Option2',
  },
  {
    value: 'Option3',
    label: 'Option3',
  },
  {
    value: 'Option4',
    label: 'Option4',
  },
  {
    value: 'Option5',
    label: 'Option5',
  },
]
</script>

<template>
  <el-card class="page-container">
    <!-- 头 -->
    <template #header>
        <div class="header" style="display: flex; align-items: center;">
          <!-- 企业、岗位搜索 -->
          <div class="mt-4" style="margin: 0 0 0 25px;">
            <el-input v-model="input3" style="max-width: 800px;" placeholder="岗位" class="input-with-select">
              <template #prepend>
                <el-select v-model="select" placeholder="企业" style="width: 115px">
                  <el-option label="企业1" value="1" />
                  <el-option label="企业2" value="2" />
                  <el-option label="企业3" value="3" />
                </el-select>
              </template> 
            </el-input>
          </div>
          <!-- 地点搜索 -->
          <el-input v-model="input_location" style="width: 240px; margin-left: 30px;" placeholder="地点"  />
          <!-- 薪资搜索 -->
          <el-input v-model="input_location" style="width: 240px; margin-left: 30px;" placeholder="薪资">
            <!-- 后缀搜索框。可选择 -->
            <!-- <template #append>
              <el-button :icon="Search" />
            </template> -->
          </el-input>
          <!-- 搜索按钮 -->
          <el-button type="primary" style="margin-left: 30px;">搜索</el-button>
          <!-- 发布按钮 -->
          <el-button type="primary" style="margin: 0 25px 0 30px;" @click="drawer=true">发布</el-button>
        </div>
      </template>
    <!-- 表格部分 -->
    <el-main class="main-table" style="padding: 0 30px;">
      <el-table :data="tableData"  style="width: 100%" >
        <el-table-column type="expand">
          <template #default="props">
            <div m="4">
              <div class="table-item">
                <div class="table-item-span">
                  <span m="t-0 b-2">任职要求: {{ props.row.qualifications}}</span>
                </div>
                <div class="table-item-span">
                  <span m="t-0 b-2">岗位职责: {{ props.row.job_responsibilities }}</span>
                </div>
              </div>
              <el-table :data="props.row.family">
                <!-- 二级表格 -->
                <el-table-column label="姓名" prop="name" />
                <el-table-column label="省份" prop="state" />
                <el-table-column label="城市" prop="city" />
                <el-table-column label="地址" prop="address" />
                <el-table-column label="邮编" prop="zip" />
              </el-table>
            </div>
          </template>
        </el-table-column>
        <!-- 一级表格 -->
        <el-table-column sortable label="Date" prop="date" />
        <el-table-column label="名称" prop="name" />
        <el-table-column label="公司" prop="company" />
        <el-table-column label="地点" prop="location" />
        <el-table-column label="薪资" prop="salary" />
        <el-table-column label="开始时间" prop="satrTime" />
        <el-table-column label="结束时间" prop="endTime" />
      </el-table> 
    </el-main>
    <template #footer>
      <div class="demo-pagination-block" style="display: flex; justify-content: center; margin-top: 1rem;">
        <el-pagination
          v-model:current-page="currentPage3"
          v-model:page-size="pageSize3"
          :size="size"
          :disabled="disabled"
          :background="background"
          layout="prev, pager, next, jumper"
          :total="1000"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </template>
        
          
          
          <!-- 抽屉部分 -->
          <el-drawer v-model="drawer" title="发布招聘" :with-header="true" size=" 35%">
            <div class="m-4" style="margin: 0px;">
              <el-select v-model="value" multiple collapse-tags collapse-tags-tooltip placeholder="所属企业" style="width: 240px" > 
                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
              <el-select-v2 v-model="value1" :options="options" placeholder="岗位名称" style="width: 240px" clearable/>
            </div>
            <div class="m-4">
              <el-select-v2 v-model="value2" :options="options" placeholder="地点" style="width: 240px" clearable/>
              <el-input-number v-model="num" style="width: 240px" :min="1" :max="100" @change="handleChange" />
            </div>
            <!-- 时间选择 -->
            <div class="demo-datetime-picker">
              <div class="block">
                <el-date-picker  v-model="datetime" type="datetimerange" start-placeholder="Start date" end-placeholder="End date" format="YYYY-MM-DD HH:mm:ss" date-format="YYYY/MM/DD ddd" time-format="A hh:mm:ss" show-now="true" style="width: 460px;" />
              </div>
            </div>
            <!-- 文本域 -->
            <div class="m-4">
              <el-input v-model="textarea" style="width: 240px; height: 80px;" type="textarea" placeholder="岗位职责" :autosize="{ minRows: 1, maxRows: 4 }"/>
              <el-input v-model="textarea1" style="width: 240px; height: 80px;" type="textarea" placeholder="任职要求" :autosize="{ minRows: 1, maxRows: 4 }"/>
            </div>
            <!-- 按钮 -->
            <div class="mb-4">
              <el-button type="primary" plain>确定</el-button>
              <el-button type="danger" plain @click="drawer = false">取消</el-button>
            </div>
          </el-drawer>
        <!-- 体部分-表格 -->
        
        <!-- <div style="display: flex; justify-content: center; margin-top: 1rem;">
            <el-pagination size="small" background layout="prev, pager, next" :total="50" class="mt-4"/>
        </div> -->
        
    </el-card>
</template>

<style scoped lang="scss">
.page-container {
  box-shadow: none !important;
  border: none !important;
}
:deep(.el-card__body) {
  padding: 0px !important;
}

.input-with-select .el-input-group__prepend {
  background-color: var(--el-fill-color-blank);
}
.m-4{
  margin-top: 30px;
}

// 时间选择器
.demo-datetime-picker {
  display: flex;
  width: 100%;
  padding: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: stretch;
}
.demo-datetime-picker .block {
  margin-top: 30px;
  text-align: center;
}
.line {
  width: 1px;
  background-color: var(--el-border-color);
}

.table-item{
  width: 45%;
  display:inline; 
  justify-content: space-between; 
  align-items: center;
}
.table-item-span{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px; 
}
</style>